/**
 * @author checkSun
 * @date   2015年5月22日
 * @time   下午2:07:32
 * @description 
 */
package com.credithc.fastdfs.monitor.web;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.credithc.fastdfs.api.entity.ErrorInfo;
import com.credithc.fastdfs.monitor.service.ErrLogService;
import com.credithc.framework.core.mybatis.page.PageController;
import com.credithc.framework.core.mybatis.page.PageDto;
import com.credithc.framework.core.utils.DataGrid;

/**
 * @author checkSun
 * @date 2015年5月22日
 * @description 错误日志管理
 */
@Controller
@RequestMapping(value = "/errLogManager")
public class ErrLogController {
	@Autowired
	private ErrLogService es;

	@RequestMapping("/errLogIndex")
	public String toIndex(Model model) {
		return "errlogmanager/errLogIndex";
	}


	@ResponseBody
	@RequestMapping("/listErrLogs")
	public DataGrid listErrLogs(PageDto pageDto,
			@RequestParam("sort") String sort,ErrorInfo einfo,
			@RequestParam("order") String order, HttpServletRequest request,
			HttpServletResponse response) {

		PageController page = pageDto.createPage();
		page.setSort(sort);
		page.setOrder(order);
		return DataGrid.formateList(es.getErrorInfosByCondition(page, einfo));

	}
}
